<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <head th:replace="common/head"/>
</head>
<body>
<div class="x-body">
    <form class="layui-form" style="padding-bottom: 10px;text-align: left;">
        <div class="layui-form-item">
            客户：
            <div class="layui-inline">
                <select name="supplierId" lay-search="">
                    <option value="">直接选择或搜索选择</option>
                    <th:block th:each="map: ${customerList}">
                        <option th:value="${map.userId}" th:text="${map.userName}"></option>
                    </th:block>
                </select>
            </div>
            取回方式：
            <div class="layui-inline">
                <select name="deliveryType" lay-search="">
                    <option value="">直接选择或搜索选择</option>
                    <th:block th:each="map: ${deliveryTypeEnum}">
                        <option th:value="${map.key}" th:text="${map.value}"></option>
                    </th:block>
                </select>
            </div>
            取回者：
            <div class="layui-inline">
                <select name="deliveryUserId" lay-search="">
                    <option value="">直接选择或搜索选择</option>
                    <th:block th:each="map: ${deliverList}">
                        <option th:value="${map.userId}" th:text="${map.userName}"></option>
                    </th:block>
                </select>
            </div>
            付款状态：
            <div class="layui-inline">
                <select name="payType" lay-search="">
                    <option value="">直接选择或搜索选择</option>
                    <th:block th:each="map: ${payTypeEnum}">
                        <option th:value="${map.key}" th:text="${map.value}"></option>
                    </th:block>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            退回时间起：
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input type="text" name="beginDate" lay-verify="myCheckDate" placeholder="yyyy-MM-dd"
                           autocomplete="off" class="layui-input layDate">
                </div>
            </div>
            止：
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input type="text" name="endDate" lay-verify="myCheckDate" placeholder="yyyy-MM-dd"
                           autocomplete="off" class="layui-input layDate">
                </div>
            </div>
            <button class="layui-btn" lay-submit lay-filter="search"><i class="layui-icon">&#xe615;</i></button>
        </div>
    </form>

    <xblock>
        <button class="layui-btn layui-btn-normal dialog" data-url="/returnBase/toAdd" data-title="添加">
            <i class="layui-icon">&#xe608;</i>添加
        </button>
    </xblock>

    <input type="hidden" id="editText" value="returnBase/editText">
    <input type="hidden" id="myEntityId" value="returnBaseId">

    <table class="layui-table"
           lay-data="{url:'/returnBase/list', page:true,id:'table',limit:15,limits:[10,15,20,50,100]}"
           lay-filter="table">
        <thead>
        <tr>
            <!--<th lay-data="{field:'demo',align:'center', sort: true, edit:'text',templet:'#templetId'}">demo</th>-->
            <!--<th lay-data="{checkbox:true, fixed: true}"></th>-->

            <th lay-data="{field:'returnBaseId',align:'center', sort: true}">returnBaseId</th>
            <th lay-data="{field:'customerId',align:'center', sort: true, templet:'#customerList'}">客户</th>
            <th lay-data="{field:'returnAddress',align:'center',edit:'text'}">取回地址</th>
            <th lay-data="{field:'returnType',align:'center', sort: true, templet:'#returnTypeEnum'}">取回类型</th>
            <th lay-data="{field:'deliveryUserId',align:'center', sort: true, templet:'#deliverList'}">取回者</th>
            <th lay-data="{field:'deliveryMoney',align:'center', sort: true}">取回费</th>
            <th lay-data="{field:'payType',align:'center', sort: true}">付款状态</th>
            <th lay-data="{field:'totalMoney',align:'center', sort: true}">各个商品总价</th>
            <th lay-data="{field:'realPayMoney',align:'center', sort: true}">实际付款</th>
            <th lay-data="{field:'returnTime',align:'center', sort: true}">退货时间</th>
            <th lay-data="{field:'remark',align:'center',edit:'text'}">备注</th>
            <th lay-data="{fixed:'right', align:'center',width:250, toolbar: '#row-bar'}">操作</th>
        </tr>
        </thead>
    </table>

    <script type="text/html" id="customerList" th:inline="javascript">
        {{#  var list = [[${customerList}]] }}
        {{#  for(var index in list){ }}
        {{#     if(d.customerId == list[index].userId){ }}
        {{         unescape(list[index].userName.replace(/\\u/g, '%u')) }}
        {{#     } }}
        {{#  } }}
    </script>

    <script type="text/html" id="deliverList" th:inline="javascript">
        {{#  var list = [[${deliverList}]] }}
        {{#  for(var index in list){ }}
        {{#     if(d.deliveryUserId == list[index].userId){ }}
        {{         unescape(list[index].userName.replace(/\\u/g, '%u')) }}
        {{#     } }}
        {{#  } }}
    </script>

    <script type="text/html" id="returnTypeEnum" th:inline="javascript">
        {{#  var map = [[${returnTypeEnum}]] }}
        {{#  for(var key in map){ }}
        {{#     if(d.returnType == key){ }}
        {{         unescape(map[key].replace(/\\u/g, '%u')) }}
        {{#     } }}
        {{#  } }}
    </script>

    <script type="text/html" id="row-bar">
        <a class="layui-btn layui-btn-noraml layui-btn-xs" lay-event="layedit" data-url="/returnGoods" data-title="该退货单的商品列表"
           data-id="returnBaseId" data-width="1200" data-height="800"><i class="layui-icon">&#xe642;</i> 商品列表</a>
        <a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="edit" data-url="/returnBase/toEdit" data-title="编辑"
           data-id="returnBaseId" data-width="800" data-height="600"><i class="layui-icon">&#xe642;</i> 编辑</a>
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" data-url="/returnBase/delete"><i
                class="layui-icon">&#xe640;</i> 删除</a>
    </script>
</div>
<div th:replace="common/js"></div>
<div th:replace="common/setting"></div>
<script type="text/javascript">
    layui.use('xtable');
</script>
</body>
</html>
